home *** CD-ROM | disk | FTP | other *** search
- Path: sdd.hp.com!inn
- From: Laura Mansfield <laura>
- Newsgroups: comp.lang.c++
- Subject: a question about abstract base classes and libraries
- Date: 2 Feb 1996 03:27:29 GMT
- Organization: Hewlett-Packard, San Diego
- Message-ID: <4es0b1$au7@news.sdd.hp.com>
- NNTP-Posting-Host: hpsdlgd6.sdd.hp.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.12 (X11; I; HP-UX A.09.05 9000/730)
- X-URL: news:comp.lang.c++
-
- A question I'm hoping someone can answer ~
-
- I'm writing a library, lib.a, to be linked to by some client code that
- will use its services. The client code will include a file, lib.h, which
- defines the class interface to lib.a. The classes have member functions
- that the client code will use to do some inventory management.
-
- I'd like to hide the private data members of this class, and so have
- decided to create and abstract base class, and make visible to the client
- code only the derived class. To better explain, here's an example:
-
- In my library code:
-
- class Abstract
- {
-
- protected:
-
- int a;
- int b;
-
- public:
-
- virtual void func( void ) = 0;
- };
-
- In lib.h:
-
- class ClassA : public abstract
- {
-
- public:
-
- virtual void func( void );
- };
-
- But I'm beginning to realize I can't really do this w/out defining
- class Abstract in lib.h. I tried to do "class Abstract;" at the beginning
- of lib.h, but I think this only works for pointers.
-
- Can anyone help me w/ what to do here?
-
- Laura
- --
-
- ************************************************************************
-
- Laura C. Mansfield _/_/_/_/_/_/_/_/_/_/_/
- Hewlett-Packard Company _/ _/ _/
- San Diego Printer Division _/
- MS-60U360 _/_/_/_/_/ _/ _/ _/
- 16399 W. Bernardo Dr. _/ _/ _/ _/_/ _/_/
- San Diego, CA 92127-1899 _/_/_/_/_/ _/ _/ _/ _/
- _/ _/ _/ _/ _/
- _/ _/ _/ _/ _/
- _/
- Gig' Em Aggies! _/_/_/_/_/
-
-
- "Truth is more than an opposing point of view." - Susan Ashton
-
- ************************************************************************
-
-